home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / prg_basi / ddfedit.zip / DDFINDEX.FRM < prev    next >
Text File  |  1996-02-05  |  19KB  |  730 lines

  1. VERSION 2.00
  2. Begin Form FormIndexDDF 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Indexes for"
  5.    ClientHeight    =   3390
  6.    ClientLeft      =   2115
  7.    ClientTop       =   4110
  8.    ClientWidth     =   5475
  9.    Height          =   3795
  10.    Left            =   2055
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   3390
  14.    ScaleWidth      =   5475
  15.    Top             =   3765
  16.    Width           =   5595
  17.    Begin SSPanel PanTop 
  18.       Align           =   1  'Align Top
  19.       AutoSize        =   3  'AutoSize Child To Panel
  20.       BevelOuter      =   0  'None
  21.       BorderWidth     =   1
  22.       Height          =   495
  23.       Left            =   0
  24.       TabIndex        =   7
  25.       Top             =   0
  26.       Width           =   5475
  27.       Begin CommandButton FldCom 
  28.          Caption         =   "New &Part"
  29.          Height          =   255
  30.          Index           =   5
  31.          Left            =   990
  32.          TabIndex        =   15
  33.          Top             =   0
  34.          Width           =   1005
  35.       End
  36.       Begin CommandButton FldCom 
  37.          Caption         =   "&Down"
  38.          Height          =   255
  39.          Index           =   4
  40.          Left            =   4320
  41.          TabIndex        =   14
  42.          Top             =   0
  43.          Width           =   735
  44.       End
  45.       Begin CommandButton FldCom 
  46.          Caption         =   "&Delete"
  47.          Height          =   255
  48.          Index           =   2
  49.          Left            =   2790
  50.          TabIndex        =   13
  51.          Top             =   0
  52.          Width           =   735
  53.       End
  54.       Begin CommandButton FldCom 
  55.          Caption         =   "&Up"
  56.          Height          =   255
  57.          Index           =   3
  58.          Left            =   3585
  59.          TabIndex        =   12
  60.          Top             =   0
  61.          Width           =   735
  62.       End
  63.       Begin CommandButton FldCom 
  64.          Caption         =   "&Edit"
  65.          Height          =   255
  66.          Index           =   1
  67.          Left            =   2070
  68.          TabIndex        =   11
  69.          Top             =   0
  70.          Width           =   735
  71.       End
  72.       Begin CommandButton FldCom 
  73.          Caption         =   "&New Index"
  74.          Height          =   255
  75.          Index           =   0
  76.          Left            =   0
  77.          TabIndex        =   10
  78.          Top             =   0
  79.          Width           =   1005
  80.       End
  81.       Begin SSPanel PanHead 
  82.          AutoSize        =   3  'AutoSize Child To Panel
  83.          BevelInner      =   1  'Inset
  84.          BevelOuter      =   0  'None
  85.          BorderWidth     =   1
  86.          Height          =   255
  87.          Left            =   0
  88.          TabIndex        =   8
  89.          Top             =   240
  90.          Width           =   5475
  91.          Begin TextBox TextTop 
  92.             BackColor       =   &H00C0C0C0&
  93.             BorderStyle     =   0  'None
  94.             Enabled         =   0   'False
  95.             ForeColor       =   &H00FF0000&
  96.             Height          =   195
  97.             Left            =   30
  98.             MultiLine       =   -1  'True
  99.             TabIndex        =   9
  100.             Text            =   "test test test"
  101.             Top             =   30
  102.             Width           =   5415
  103.          End
  104.       End
  105.    End
  106.    Begin TextBox XPath 
  107.       Height          =   285
  108.       Left            =   0
  109.       TabIndex        =   6
  110.       Top             =   2280
  111.       Visible         =   0   'False
  112.       Width           =   180
  113.    End
  114.    Begin TextBox XFDFlags 
  115.       Height          =   285
  116.       Left            =   960
  117.       TabIndex        =   5
  118.       Top             =   2280
  119.       Visible         =   0   'False
  120.       Width           =   180
  121.    End
  122.    Begin TextBox XFDLocation 
  123.       Height          =   285
  124.       Left            =   720
  125.       TabIndex        =   4
  126.       Top             =   2280
  127.       Visible         =   0   'False
  128.       Width           =   180
  129.    End
  130.    Begin TextBox XFDName 
  131.       Height          =   285
  132.       Left            =   480
  133.       TabIndex        =   3
  134.       Top             =   2280
  135.       Visible         =   0   'False
  136.       Width           =   180
  137.    End
  138.    Begin TextBox XFDid 
  139.       Height          =   285
  140.       Left            =   240
  141.       TabIndex        =   2
  142.       Top             =   2280
  143.       Visible         =   0   'False
  144.       Width           =   180
  145.    End
  146.    Begin SSPanel PanList 
  147.       AutoSize        =   3  'AutoSize Child To Panel
  148.       BevelInner      =   1  'Inset
  149.       BevelOuter      =   0  'None
  150.       BorderWidth     =   1
  151.       Height          =   1650
  152.       Left            =   0
  153.       TabIndex        =   0
  154.       Top             =   1320
  155.       Width           =   4815
  156.       Begin ListBox Llist 
  157.          Height          =   1590
  158.          Left            =   30
  159.          TabIndex        =   1
  160.          Top             =   30
  161.          Width           =   4755
  162.       End
  163.    End
  164. End
  165. Option Explicit
  166. Dim CurrentOffset As Integer
  167. Dim inited As Integer
  168. Dim Local_File_Changed As Integer
  169. Dim FieldArr() As XDField_def
  170. Dim FieldLast As Integer
  171. Dim indexArr() As XDIndex_def
  172. Dim IndexLast As Integer
  173. Dim CurrListIndex As Integer
  174.  
  175. Sub FieldArrfill ()
  176.   Dim Keybuf As KeyBufDef
  177.   Dim KeyBufLen As Integer
  178.   Dim XDField As XDField_def
  179.   Dim BufLen As Integer
  180.   Dim stat As Integer
  181.   Dim PosBlk As PosBlkDef
  182.   Dim FileFullPath As String
  183.   Dim X As Integer
  184.   Dim XDFieldKey1 As XDFieldKey1_def
  185.   Dim i As Integer
  186.   Dim j As Integer
  187.   Dim p1 As Integer
  188.   Dim p2 As Integer
  189.  
  190.   Debug.Print "listfill"
  191.   
  192.   llist.Clear
  193.  
  194.   KeyBufLen = Len(Keybuf)
  195.   BufLen = Len(XDField)
  196.  
  197.   ' first open the file
  198.   FileFullPath = XPath & "Field.DDF"
  199.   Keybuf.kb = FileFullPath
  200.   KeyBufLen = Len(Keybuf)
  201.   BufLen = 0
  202.   
  203.   stat = btrcall(B_OPEN, PosBlk, XDField, BufLen, Keybuf, KeyBufLen, 0)
  204.   If stat <> 0 Then
  205.     MsgBox "Btrieve Error Opening file " & FileFullPath & Chr(10) & stat & " " & BtErr(stat)
  206.     Exit Sub
  207.   End If
  208.  
  209.  
  210.   KeyBufLen = Len(XDFieldKey1): BufLen = Len(XDField)
  211.   XDFieldKey1.XeDFile = Val(XFDid.Text)
  212.   stat = btrcall(B_GETGE, PosBlk, XDField, BufLen, XDFieldKey1, KeyBufLen, 1)
  213.   
  214.   CurrentOffset = 0
  215.   FieldLast = 0
  216.   Do
  217.     If stat <> 0 Then Exit Do
  218.     
  219.     If XDField.XeDFile <> Val(XFDid.Text) Then Exit Do
  220.  
  221.     CurrListIndex = 0
  222.     ReDim Preserve FieldArr(FieldLast)
  223.     FieldArr(FieldLast) = XDField
  224.     FieldLast = FieldLast + 1
  225.    
  226.     KeyBufLen = Len(XDFieldKey1): BufLen = Len(XDField)
  227.     stat = btrcall(B_GETNX, PosBlk, XDField, BufLen, XDFieldKey1, KeyBufLen, 1)
  228.   
  229.   Loop
  230.  
  231.   If (stat <> 9 And stat <> 0) Then MsgBox "Btrieve Error Retrieving Record in FILE file " & Chr(10) & stat & " " & BtErr(stat)
  232.   stat = btrcall(B_CLOSE, PosBlk, XDField, BufLen, Keybuf, KeyBufLen, 0)
  233.  
  234. End Sub
  235.  
  236. Sub FillNewIndexForm (Setto As Integer)
  237.   Dim i As Integer
  238.   Dim idx As Integer
  239.  
  240.   idx = -1
  241.   FormNewIndex.FieldList.Clear
  242.   For i = 0 To FieldLast - 1
  243.     FormNewIndex.FieldList.AddItem Trim(FieldArr(i).XeDName)
  244.     FormNewIndex.FieldList.ItemData(FormNewIndex.FieldList.NewIndex) = FieldArr(i).XeDid
  245.     If Setto <> -1 Then
  246.       If indexArr(Setto).XidField = FieldArr(i).XeDid Then idx = i
  247.     End If
  248.   Next i
  249.  
  250.   
  251.   FormNewIndex.FieldList.ListIndex = idx
  252.  
  253.   If Setto <> -1 Then ' I've got to set the flags !!!!
  254.     For i = 0 To 9
  255.       If (indexArr(Setto).XiDFlags And (2 ^ i)) > 0 Then
  256.         FormNewIndex.KeyFlag(i).Value = True
  257.       Else
  258.         FormNewIndex.KeyFlag(i).Value = False
  259.       End If
  260.  
  261.     Next i
  262.   End If
  263.  
  264.  
  265. End Sub
  266.  
  267. Sub FldCom_Click (Index As Integer)
  268.   
  269.   Select Case Index
  270.     Case 0: IndexNewIndex 'new Index
  271.     Case 1: IndexEdit ' edit Index
  272.     Case 2: IndexDelete ' delete Index
  273.     Case 3: IndexMove (-1)' Move Index Up
  274.     Case 4: IndexMove (1) ' Move Index Down
  275.     Case 5: IndexNewPart
  276.   End Select
  277. End Sub
  278.  
  279. Sub Form_Activate ()
  280.   Debug.Print "Activated"
  281.   If inited Then Exit Sub
  282.   Me.Caption = "Indexes for """ & Trim(XfDName.Text) & """ (" & Trim(XFDLocation.Text) & ")"
  283.   If Val(XFDFlags.Text) = 16 Then
  284.     FldCom(0).Enabled = False
  285.     FldCom(1).Enabled = False
  286.     FldCom(2).Enabled = False
  287.     FldCom(3).Enabled = False
  288.     FldCom(4).Enabled = False
  289.   End If
  290.   FieldArrfill
  291.   IndexArrFill
  292.   listfill
  293.   If inited = False Then inited = True
  294.  
  295. End Sub
  296.  
  297. Sub Form_Load ()
  298.   
  299.   CurrListIndex = -1
  300.   Local_File_Changed = False
  301.   
  302.   inited = False
  303. End Sub
  304.  
  305. Sub Form_Resize ()
  306.   If windowstate = 1 Then Exit Sub
  307.   PanHead.Left = 0
  308.   PanHead.Width = PanTop.Width
  309.   PanList.Left = 0
  310.   PanList.Width = ScaleWidth
  311.   PanList.Top = PanTop.Height
  312.   PanList.Height = ScaleHeight - PanList.Top
  313. End Sub
  314.  
  315. Sub Form_Unload (Cancel As Integer)
  316.   Dim r As Integer
  317.   
  318.   If Local_File_Changed Then
  319.     r = MsgBox("Changes Made. Do you wish so save changes ?", 3 + 32, "Indexes Changed")
  320.     Select Case r
  321.       Case 2
  322.         Cancel = True
  323.       Case 6
  324.         Indexes_Remove (XPath.Text), (Val(XFDid.Text))
  325.         Indexes_Add
  326.     End Select
  327.   End If
  328. End Sub
  329.  
  330. Sub IndexArrFill ()
  331.   Dim Keybuf As KeyBufDef
  332.   Dim KeyBufLen As Integer
  333.   Dim XDIndex As XDIndex_def
  334.   Dim BufLen As Integer
  335.   Dim stat As Integer
  336.   Dim PosBlk As PosBlkDef
  337.   Dim FileFullPath As String
  338.   Dim X As Integer
  339.   Dim XDIndexKey0 As XDIndexKey0_def
  340.   Dim i As Integer
  341.   Dim j As Integer
  342.   Dim p1 As Integer
  343.   Dim p2 As Integer
  344.  
  345.   
  346. 'Type XDIndexKey0_def
  347. '  XiDFile As Integer
  348. 'End Type
  349.   
  350.   Debug.Print "listfill"
  351.   
  352.   llist.Clear
  353.  
  354.   KeyBufLen = Len(Keybuf)
  355.   BufLen = Len(XDIndex)
  356.  
  357.   ' first open the file
  358.   FileFullPath = XPath & "Index.DDF"
  359.   Keybuf.kb = FileFullPath
  360.   KeyBufLen = Len(Keybuf)
  361.   BufLen = 0
  362.   
  363.   stat = btrcall(B_OPEN, PosBlk, XDIndex, BufLen, Keybuf, KeyBufLen, 0)
  364.   If stat <> 0 Then
  365.     MsgBox "Btrieve Error Opening file " & FileFullPath & Chr(10) & stat & " " & BtErr(stat)
  366.     Exit Sub
  367.   End If
  368.  
  369.  
  370.   KeyBufLen = Len(XDIndexKey0): BufLen = Len(XDIndex)
  371.   XDIndexKey0.XiDFile = Val(XFDid.Text)
  372.   stat = btrcall(B_GETGE, PosBlk, XDIndex, BufLen, XDIndexKey0, KeyBufLen, 0)
  373.   
  374.   
  375.   IndexLast = 0
  376.   Do
  377.     If stat <> 0 Then Exit Do
  378.     
  379.     If XDIndex.XiDFile <> Val(XFDid.Text) Then Exit Do
  380.  
  381.   '  CurrListIndex = 0
  382.     ReDim Preserve indexArr(IndexLast)
  383.     indexArr(IndexLast) = XDIndex
  384.     IndexLast = IndexLast + 1
  385.    
  386.     KeyBufLen = Len(XDIndexKey0): BufLen = Len(XDIndex)
  387.     stat = btrcall(B_GETNX, PosBlk, XDIndex, BufLen, XDIndexKey0, KeyBufLen, 0)
  388.   
  389.   Loop
  390.  
  391.   If (stat <> 9 And stat <> 0) Then MsgBox "Btrieve Error Retrieving Record in FILE file " & Chr(10) & stat & " " & BtErr(stat)
  392.   stat = btrcall(B_CLOSE, PosBlk, XDIndex, BufLen, Keybuf, KeyBufLen, 0)
  393.   CurrListIndex = -1
  394. End Sub
  395.  
  396. Sub IndexDelete ()
  397.   
  398.   Dim CurIdx As Integer
  399.   
  400.   CurIdx = llist.ListIndex
  401.  
  402.   If CurIdx = -1 Then Exit Sub
  403.  
  404.   llist.RemoveItem CurIdx
  405.   
  406.   If CurIdx > llist.ListCount - 1 Then
  407.     CurrListIndex = llist.ListCount - 1
  408.   Else
  409.     CurrListIndex = CurIdx
  410.   End If
  411.  
  412.   ListExtract
  413.   ListAdjust
  414.   listfill
  415.   Local_File_Changed = True
  416.  
  417.  
  418.  
  419. End Sub
  420.  
  421. Sub IndexEdit ()
  422.   
  423.   Dim fidx As Integer
  424.   fidx = llist.ListIndex
  425.   If fidx = -1 Then Exit Sub
  426.   
  427.   Curr_file_Changed = Local_File_Changed
  428.   
  429.   
  430.   Load FormNewIndex
  431.   FormNewIndex.Caption = "Edit Index"
  432.   FillNewIndexForm (fidx)
  433.   FormNewIndex.IndexIdx = llist.ItemData(llist.ListIndex)
  434.   FormNewIndex.IndexNewPart = 0
  435.   
  436.  
  437.   FormNewIndex.XFDid.Text = Trim(XFDid.Text)
  438.   FormNewIndex.XPath.Text = Trim(XPath.Text)
  439.   FormNewIndex.IndexIdx = fidx
  440.   FormNewIndex.Show 1
  441.   Local_File_Changed = Curr_file_Changed
  442.   If Local_File_Changed Then
  443.     ListExtract
  444.     ListAdjust
  445.     CurrListIndex = IndexLast - 1
  446.     listfill
  447.   End If
  448.  
  449.  
  450. End Sub
  451.  
  452. Sub Indexes_Add ()
  453.   
  454.   ' Add all Indexs to the current file XeDid
  455.   ' XPath & Index.ddf
  456.  
  457.   Dim stat As Integer
  458.   Dim KeyNum As Integer
  459.   Dim PosBlk As PosBlkDef
  460.   Dim Keybuf As KeyBufDef
  461.   Dim KeyBufLen As Integer
  462.   Dim BufLen As Integer
  463.   Dim FileFullPath As String
  464.   Dim XDIndex As XDIndex_def
  465.   Dim i As Integer, r As Integer
  466.  
  467. ' ************************************************************************************
  468. ' Now we add records to the Index.DDF file
  469. ' ************************************************************************************
  470.  
  471.   FileFullPath = XPath.Text & "Index.DDF"
  472.   Keybuf.kb = FileFullPath
  473.   KeyBufLen = Len(Keybuf)
  474.   BufLen = 0
  475.   
  476.   status "Adding Indexs to file " & FileFullPath
  477.   
  478.   stat = btrcall(B_OPEN, PosBlk, XDIndex, BufLen, Keybuf, KeyBufLen, 0)
  479.   If stat <> 0 Then
  480.     MsgBox "Btrieve Error Opening file " & FileFullPath & Chr(10) & stat & " " & BtErr(stat)
  481.     Exit Sub
  482.   End If
  483.  
  484.   ' Records for FILE.DDF
  485.  
  486.   For i = 0 To IndexLast - 1
  487.     r = AddRecordToIndexDDF(PosBlk, (Val(XFDid.Text)), (indexArr(i).XidField), (indexArr(i).XidNumber), (indexArr(i).XiDPart), (indexArr(i).XiDFlags))
  488.   Next i
  489.  
  490.   stat = btrcall(B_CLOSE, PosBlk, XDIndex, BufLen, Keybuf, KeyBufLen, 0)
  491.   
  492.  
  493. End Sub
  494.  
  495. Sub IndexMove (WhichWay As Integer)
  496.   Dim CurIdx As Integer, NewIdx As Integer
  497.   Dim i As Integer
  498.   Dim TempArr As XDIndex_def
  499.   
  500.   CurIdx = llist.ListIndex
  501.  
  502.   If CurIdx = -1 Then Exit Sub
  503.  
  504.   NewIdx = CurIdx + WhichWay
  505.   If NewIdx < 0 Then Exit Sub
  506.   If NewIdx > llist.ListCount - 1 Then
  507.     If llist.ListCount = 1 Then
  508.       Exit Sub
  509.     Else
  510.       If MsgBox("You have reached the bottom of the list" & Chr(10) & "Do you wish to start a New Index with this Part ?", 4 + 32, "WARNING") = 6 Then
  511.         indexArr(CurIdx).XidNumber = 999
  512.       Else
  513.         Exit Sub
  514.       End If
  515.     End If
  516.   Else
  517.   
  518.     If indexArr(NewIdx).XidNumber <> indexArr(CurIdx).XidNumber Then
  519.       If MsgBox("You are trying to move a part of an index into another index" & Chr(10) & "Are you Sure you wish to do this ?", 4 + 32, "WARNING") = 6 Then
  520.         indexArr(CurIdx).XidNumber = indexArr(NewIdx).XidNumber
  521.       Else
  522.         Exit Sub
  523.       End If
  524.     Else
  525.       TempArr = indexArr(NewIdx)
  526.       indexArr(NewIdx) = indexArr(CurIdx)
  527.       indexArr(CurIdx) = TempArr
  528.     End If
  529.     CurrListIndex = NewIdx
  530.   End If
  531.   ListAdjust
  532.   
  533.   listfill
  534.   Local_File_Changed = True
  535.  
  536.  
  537.  
  538. End Sub
  539.  
  540. Sub IndexNewIndex ()
  541.   
  542.   Curr_file_Changed = Local_File_Changed
  543.   Load FormNewIndex
  544.   FormNewIndex.Caption = "Add New Index"
  545.   FormNewIndex.XFDid.Text = XFDid.Text
  546.   FormNewIndex.XPath.Text = XPath.Text
  547.   FormNewIndex.IndexIdx = -1
  548.   FormNewIndex.IndexNewPart = 0
  549.   FillNewIndexForm (-1)
  550.   FormNewIndex.Show 1
  551.   Local_File_Changed = Curr_file_Changed
  552.   If Local_File_Changed Then
  553.     ListExtract
  554.     ListAdjust
  555.     CurrListIndex = IndexLast - 1
  556.     listfill
  557.   End If
  558.  
  559. End Sub
  560.  
  561. Sub IndexNewPart ()
  562.   
  563.   
  564.   If llist.ListIndex = -1 Then Exit Sub
  565.  
  566.   Curr_file_Changed = Local_File_Changed
  567.   Load FormNewIndex
  568.   FormNewIndex.Caption = "Add New Part"
  569.   FillNewIndexForm (-1)
  570.   FormNewIndex.XFDid.Text = XFDid.Text
  571.   FormNewIndex.XPath.Text = XPath.Text
  572.   FormNewIndex.IndexIdx = llist.ItemData(llist.ListIndex)
  573.   FormNewIndex.IndexNewPart = 1
  574.   FormNewIndex.Show 1
  575.   Local_File_Changed = Curr_file_Changed
  576.   If Local_File_Changed Then
  577.     ListExtract
  578.     ListAdjust
  579.     CurrListIndex = IndexLast - 1
  580.     listfill
  581.   End If
  582.  
  583.  
  584. End Sub
  585.  
  586. Sub ListAdjust ()
  587.   
  588.   Dim i As Integer
  589.   Dim CurrIndex As Integer
  590.   
  591.   Dim NewPart As Integer
  592.   Dim NewIndex As Integer
  593.  
  594. '  XiDFile - Done Later
  595. '  XidField As Integer                       ' Filed ID (XeDid in FILED.DFF above)
  596. '  XiDNumber - Done Later
  597. '  XiDPart - Done Later
  598. '  XiDFlags As Integer                       ' Flags of Key
  599.  
  600.   ' first we renumber the indexes, just incase he's deleted some inbetween, and we ad the FIleID
  601.  
  602.   Debug.Print "*** INDEXES FOUND"
  603.   For i = 0 To IndexLast - 1
  604.     Debug.Print i; indexArr(i).XiDFile; indexArr(i).XiDPart
  605.   Next i
  606.  
  607.   
  608.   NewIndex = -1
  609.   CurrIndex = -1
  610.   NewPart = 0
  611.   
  612.   For i = 0 To IndexLast - 1
  613.     ' set the file
  614.     indexArr(i).XiDFile = Val(XFDid.Text)
  615.     Debug.Print "Curr "; CurrIndex; "  Found "; indexArr(i).XidNumber
  616.     If indexArr(i).XidNumber <> CurrIndex Then
  617.       
  618.       CurrIndex = indexArr(i).XidNumber
  619.       NewIndex = NewIndex + 1
  620.     End If
  621.     Debug.Print "Setting Index to "; NewIndex
  622.     indexArr(i).XidNumber = NewIndex
  623.   
  624.   Next i
  625.  
  626.  
  627.   ' Now we renumber the parts and add seg flags accordingly
  628.  
  629.   NewPart = 0
  630.   CurrIndex = 0
  631.   For i = 0 To IndexLast - 1
  632.     
  633.     ' always remove the SEG Part from current index
  634.     If (indexArr(i).XiDFlags And K_SEG) > 0 Then indexArr(i).XiDFlags = indexArr(i).XiDFlags - K_SEG
  635.  
  636.     If indexArr(i).XidNumber <> CurrIndex Then ' End of a key
  637.       NewPart = 0
  638.       CurrIndex = indexArr(i).XidNumber
  639.     Else ' it's a segment of the key, therefore I have to add K_SEG to the PREVIOUS part (If we're not on Part 0 !)
  640.       If i <> 0 Then
  641.         indexArr(i - 1).XiDFlags = indexArr(i - 1).XiDFlags + K_SEG
  642.         NewPart = NewPart + 1
  643.       End If
  644.     End If
  645.     
  646.  
  647.     indexArr(i).XiDPart = NewPart
  648.     
  649.     
  650.     
  651.   
  652.   Next i
  653.  
  654.   
  655. End Sub
  656.  
  657. Sub ListExtract ()
  658.  
  659.   Dim i As Integer
  660.   Dim ll As String
  661.   Dim p1 As Integer, p2 As Integer
  662.  
  663.  
  664. ' first extract values from list into array
  665.  
  666.   IndexLast = llist.ListCount
  667.   For i = 0 To IndexLast - 1
  668.     ReDim Preserve indexArr(i)
  669.     ll = llist.List(i)
  670.  
  671.     indexArr(i).XiDFile = -1 ' Will need to be recalculated starting from last
  672.     
  673.     
  674.  
  675. '  XiDFile - Done Later
  676. '  XidField As Integer                       ' Filed ID (XeDid in FILED.DFF above)
  677. '  XiDNumber - Done Later
  678. '  XiDPart - Done Later
  679. '  XiDFlags As Integer                       ' Flags of Key
  680.  
  681.  '  "Number"
  682.     p1 = 1: p2 = InStr(p1, ll, Chr(9))
  683.     indexArr(i).XidNumber = Val(Mid(ll, p1, p2 - p1))
  684.  
  685.  '  "Part" -skip
  686.     p1 = p2 + 1: p2 = InStr(p1, ll, Chr(9))
  687.  
  688.  '  "Field"
  689.     p1 = p2 + 1: p2 = InStr(p1, ll, Chr(9))
  690.     indexArr(i).XidField = Val(Mid(ll, p1, p2 - p1))
  691.  
  692.  '  "Name" - skip
  693.     p1 = p2 + 1: p2 = InStr(p1, ll, Chr(9))
  694.  
  695.  '  "Flags"
  696.     p1 = p2 + 1
  697.     indexArr(i).XiDFlags = Val(Mid(ll, p1))
  698.   Next i
  699.  
  700. End Sub
  701.  
  702. Sub listfill ()
  703.   'fills the index list
  704.   
  705.   Dim i As Integer, j As Integer
  706.   Dim ll As String
  707.   Dim Fid As Integer
  708.  
  709.   llist.Clear
  710.  
  711.   Texttop.Text = "Number" & Chr(9) & "Part" & Chr(9) & "Field" & Chr(9) & "Name" & Chr(9) & "Flags"
  712.   
  713.   For i = 0 To IndexLast - 1
  714.     For j = 0 To FieldLast - 1
  715.       If FieldArr(j).XeDid = indexArr(i).XidField Then
  716.         Fid = j
  717.         Exit For
  718.       End If
  719.     Next j
  720.     
  721.     llist.AddItem Format(indexArr(i).XidNumber, "0") & Chr(9) & Format(indexArr(i).XiDPart, "0") & Chr(9) & Format(indexArr(i).XidField, "0") & Chr(9) & Trim(FieldArr(Fid).XeDName) & Chr(9) & Format(indexArr(i).XiDFlags, "0")
  722.     llist.ItemData(llist.NewIndex) = indexArr(i).XidNumber
  723.   Next i
  724.   llist.ListIndex = CurrListIndex
  725.  
  726.   i = AutoSetTabStopsCheck(llist, Texttop, False, False)
  727.  
  728. End Sub
  729.  
  730.